<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>bar</title>
    <script src="../echarts.min.js"></script>
</head>
<body>
    <!-- 为ECharts准备一个具备大小（宽高）的DOM -->
    <div id="main" style="width: 900px; height: 600px"></div>

    <script>
        // 基于准备好的DOM，初始化echarts实例
        var myChart = echarts.init(document.getElementById('main'));

        // 指定图标的配置项和数据
        var option = {
            tooltip: {
                // trigger: 'item',
                formatter: '{a}<br/>{b} : {c}%'
            },
            toolbox: {
                feature: {
                    restore: {},
                    saveAsImage: {}
                }
            },
            series: [{
                name: '业务指标',
                type: 'gauge',
                detail: {formater: '{value}%'},
                data: [
                    {value: 32, name: '完成率'}
                ],
            }]
        };
        // 使用刚指定的配置项和数据显示图标
        myChart.setOption(option)
        setInterval(function(){
            option.series[0].data[0].value = (Math.random() * 100).toFixed(2) - 0;
            myChart.setOption(option, true);
        }, 2000)
    </script>
</body>
</html>